using Unity.VisualScripting;
using GameFramework.DataNode;

namespace LS.UGFUnits
{
    [UnitSurtitle("Entity Property")]
    [UnitShortTitle("Get")]
    public sealed class GetEntityProperty : EntityUnit
    {
        [DoNotSerialize]
        public ValueOutput EntityCount { get; private set; }

        [DoNotSerialize]
        public ValueOutput EntityGroupCount { get; private set; }
        
        protected override void Definition()
        {
            base.Definition();
            EntityCount = ValueOutput<int>(nameof(EntityCount));
            EntityGroupCount = ValueOutput<int>(nameof(EntityGroupCount));
        }

        protected override ControlOutput In(Flow flow)
        {
            flow.SetValue(EntityCount, Target?.EntityCount ?? 0);
            flow.SetValue(EntityGroupCount, Target?.EntityGroupCount ?? 0);
            return base.In(flow);
        }
    }
}